@extends('Admin.Index.index')
@section('title')
    标签列表
@endsection
@section('content')
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 商品管理 <span class="c-gray en">&gt;</span> 标签管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray"> <a class="btn btn-primary radius" href="{{url('tags_add')}}"><i class="Hui-iconfont">&#xe600;</i> 添加标签</a> </span> <span class="r">共有数据：<strong>{{$count}}</strong> 条</span> </div>
    <table class="table table-border table-bordered table-hover table-bg">
        <thead>
        <tr>
            <th scope="col" colspan="6">标签管理</th>
        </tr>
        <tr class="text-c">
            <th width="40">ID</th>
            <th width="40">标签名称</th>
            <th width="70">操作</th>
        </tr>
        </thead>
        <tbody>
        @foreach($data as $v)
        <tr class="text-c">
            <td>{{$v->tag_id}}</td>
            <td>{{$v->tag_name}}</td>
            <td class="f-14">
                <a title="编辑" href="javascript:;" onclick="admin_role_edit('标签编辑','?','1')" style="text-decoration:none">
                    <i class="Hui-iconfont">&#xe6df;</i>
                </a>
                <a title="删除" id="tag_del" href="javascript:;" onclick="tag_del(this,'{{$v->tag_id}}')" class="ml-5" style="text-decoration:none">
                    <i class="Hui-iconfont">&#xe6e2;</i>
                </a>
            </td>
        </tr>
        @endforeach
        </tbody>
    </table>
</div>
<script type="text/javascript">
    function tag_del(obj,tag_id){
        layer.confirm('角色删除须谨慎，确认要删除吗？',function(index){
            $.ajax({
                type: 'POST',
                url: 'tagsDel?tag_id='+tag_id,
                dataType: 'json',
                success: function(data){
                    console.log(data);
                    $(obj).parents("tr").remove();
                    layer.msg(data.info,{icon:1,time:1000});
                    window.location.reload();
                },
                error:function(data) {
                    console.log(data.msg);
                    layer.msg('删除失败!',{icon:1,time:1000});
                    window.location.reload();
                },
            });
        });
   }
</script>
@endsection
